package com.arithmetic.list;

import org.junit.jupiter.api.Test;

/**
 * @author chenyichang
 * @date 2022/8/7
 */
public class ListArithmeticTest {

    public static ListNode head = null;

    static {
        ListNode node1 = new ListNode(1);
        ListNode node2 = new ListNode(2);
        ListNode node3 = new ListNode(3);
        ListNode node4 = new ListNode(4);
        ListNode node5 = new ListNode(5);
        node4.setNext(node5);
        node3.setNext(node4);
        node2.setNext(node3);
        node1.setNext(node2);
        head = node1;
    }


    @Test
    public void testReverseBetween() {
        System.out.println(ListArithmetic.reverseBetween(head, 2, 4));
    }

    /**
     * 测试反转链表
     */
    @Test
    public void testReverse0() {
        System.out.println(ListArithmetic.reverse0(head));
    }

    /**
     * 测试反转链表
     */
    @Test
    public void testReverse() {
        System.out.println(ListArithmetic.reverse(head));
    }

    /**
     * 测试head链表
     */
    @Test
    public void printHead() {
        System.out.println(head);
    }

}
